package config;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class SpringContextUtil {
    private static ApplicationContext applicationContext;
    static {
        if(applicationContext==null){
            applicationContext =new ClassPathXmlApplicationContext("classpath:applicationContext.xml");
        }
    }
    public static Object getBean(String name,Class beanClass){
        return applicationContext.getBean(name,beanClass);
    }
}
